package cn.tedu.spring.di;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Component
//@Service
//@Controller
//@Repository
public class UserDao {
    /*

    Value注解
    1.依赖注入注解[创建Bean对象过程中给属性赋值]
    2.
     */
    @Value("jdbc:mysql://localhost:3306/tedu")
    private String dbUrl;
    @Value("root")//@Value注解，将值"root"注入到该字段
    private String username;
    @Value("root")
    private String password;

    @Override
    public String toString() {
        return "UserDao{" +
                "dbUrl='" + dbUrl + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
